/*
 * @Author: 'zhangkeqq' '2211709169@qq.com'
 * @Date: 2025-07-25 13:17:23
 * @LastEditors: 'zhangkeqq' '2211709169@qq.com'
 * @LastEditTime: 2025-07-28 11:53:42
 * @FilePath: \vue3-admin-node\node-express\router\userinfo.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
//导入express模块
const express = require('express')
//使用express创建路由
const router = express.Router()
//导入expressJoi
const expressJoi = require('@escook/express-joi')

//导入userinfo的路由处理模块
const userinfoHandler = require('../router_handle/userinfo')

//导入验证规则
const {
    password_limit,
    name_limt,
    email_limit,
    forgetPassword_limit,
} = require('../limit/user')
//上传头像
router.post('/uploadAvatar',userinfoHandler.uploadAvatar)
//绑定账号
router.post('/bindAccount',userinfoHandler.bindAccount)
//修改用户密码
router.post('/changePassword', expressJoi(password_limit),userinfoHandler.changePassword)
//获取用户信息
router.post('/getUserInfo',userinfoHandler.getUserInfo)
//修改姓名 expressJoi(name_limt),
router.post('/changeName',userinfoHandler.changeName)
//修改性别
router.post('/changeSex',userinfoHandler.changeSex)
//修改邮箱
router.post('/changeEmail',expressJoi(email_limit),userinfoHandler.changeEmail)
//验证账号与邮箱
router.post('/verifyAccountAndEmail',userinfoHandler.verifyAccountAndEmail)
//登录页面修改密码
router.post('/changePasswordInLogin',expressJoi(forgetPassword_limit),userinfoHandler.changePasswordInLogin)

//------------------用户管理
//添加管理员
router.post('/createAdmin',userinfoHandler.createAdmin)
// 获取管理员列表
router.post('/getAdminList',userinfoHandler.getAdminList)
// 编辑管理员账号信息
router.post('/editAdmin',userinfoHandler.editAdmin)
// 对管理员取消赋权
router.post('/changeIdentityToUser',userinfoHandler.changeIdentityToUser)
//对用户进行赋权
router.post('/changeIdentityToAdmin',userinfoHandler.changeIdentityToAdmin)
//通过账号对用户搜索 
router.post('/searchUser',userinfoHandler.searchUser)
// 通过部门对用户搜索
router.post('/searchUserByDepartment',userinfoHandler.searchUserByDepartment)
// 冻结账号/解冻账号
router.post('/banHotUser',userinfoHandler.banHotUser)
// 获取冻结用户列表
router.post('/getBanList',userinfoHandler.getBanList)
// 删除用户id
router.post('/deleteUser',userinfoHandler.deleteUser)
//对外暴露路由
module.exports = router